#[[
Copyright (c) HiSilicon Technologies Co., Ltd. 2020-2020. All rights reserved.
]]

set(QT Widgets Network Gui Core SerialPort Xml)
find_package(Qt5 COMPONENTS ${QT} REQUIRED)

set(FORMS 
    BurnDlg/BurnDlg3X.ui
    BurnDlg/BurnDlgDfu.ui
    BurnDlg/BurnDlgHsan.ui
    BurnDlg/BurnDlgJLink.ui
    BurnDlg/BurnDlgSle.ui
    BurnDlg/BurnDlgMcu.ui
    BurnDlg/EraseConfigSetting.ui
    BurnDlg/IPConfigSetting.ui
    BurnDlg/MultipleBurn.ui
    BurnDlg/MultipleBurnDlgForOne.ui
    BurnDlg/ParamSettingDlg.ui
    BurnDlg/WifiBurnDlg.ui
    MenuSettingUSB.ui
    MenuSettings.ui
    MenuSettingsJLink.ui
    upgrade/UpgradeDlg.ui
)

set(RESOURCES 
    images.qrc
	translators.qrc
)

set(TRANSLATIONS 
    CNBurnTool.ts
	EnglishBurnTool.ts
)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

#add_definitions(-DUNICODE)
add_definitions(-DUNICODE -D_UNICODE)
add_definitions(-DWIN32)
add_definitions(-DO3)

#link_directories(${PROJECT_SOURCE_DIR}/lib_RD)

include_directories(../OpenSource/openssl/include)
include_directories(../OpenSource/libusb/libusb)
include_directories(../platform/3XBurn/include)

include_directories(${PLATFORM_ROOT_DIR}/securec/include)
include_directories(./BurnCtrl)
include_directories(./BurnDlg)
include_directories(./BurnToolCommon)
include_directories(./Modem)
include_directories(./SecureLink)
include_directories(./SerialPort)
include_directories(./upgrade)
include_directories(./BurnDlg)
#include_directories(../platform/3XBurn/include)

aux_source_directory(. SRC_FILES)
aux_source_directory(./BurnCtrl SRC_FILES_BURNCTRL)
aux_source_directory(./BurnDlg SRC_FILES_BURNDLG)
aux_source_directory(./BurnToolCommon SRC_FILES_BURNTOOLCOMMON)
aux_source_directory(./Modem SRC_FILES_MODEM)
aux_source_directory(./SecureLink SRC_FILES_SECURELINK)
aux_source_directory(./SerialPort SRC_FILES_SERIALPORT)
aux_source_directory(./upgrade SRC_FILES_UPGRADE)

set(TARGET BurnTool)
add_executable(${TARGET} ${SRC_FILES} ${SRC_FILES_BURNCTRL} ${SRC_FILES_BURNDLG} ${SRC_FILES_BURNTOOLCOMMON} ${SRC_FILES_MODEM} ${SRC_FILES_SECURELINK} ${SRC_FILES_SERIALPORT} ${SRC_FILES_UPGRADE} ../platform/Securec/memset_s.c)

target_link_libraries(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/platform/3XBurn/dll/libburn.dll
    Qt5::Widgets
    Qt5::Network
    Qt5::Gui
    Qt5::SerialPort
    Qt5::Core
    Qt5::Xml
    shlwapi
    pthread
    wsock32
    ws2_32
    winmm
    setupapi
    hid
    ${CMAKE_SOURCE_DIR}/output/windows/libssl-3-x64.dll
    ${CMAKE_SOURCE_DIR}/output/windows/libcrypto-3-x64.dll
    iphlpapi
    ${CMAKE_SOURCE_DIR}/output/windows/libusb-1.0.dll
    ssp
)

target_compile_definitions(${TARGET} PRIVATE BURNTOOL_LIBRARY)
target_include_directories(${TARGET} PRIVATE "${CMAKE_BINARY_DIR}/Test_autogen/include_Debug")
add_definitions(-w)
#add_executable(BurnTool2 ${SRC_FILES} ${SRC_FILES_BURNCTRL} ${SRC_FILES_BURNDLG} ${SRC_FILES_BURNTOOLCOMMON} ${SRC_FILES_MODEM} ${SRC_FILES_SECURELINK} ${SRC_FILES_SERIALPORT} ${SRC_FILES_UPGRADE} ../platform/Securec/memset_s.c)

